<template>
	<view>
		<u-navbar :placeholder='true' leftText="返回" :title="title" :safeAreaInsetTop="true">
			<view class="u-nav-slot" slot="left">
				<u-icon name="arrow-left" size="19" @click='back'></u-icon>
				<u-line direction="column" :hairline="false" length="16" margin="0 8px"></u-line>
				<u-icon name="home" size="20" @click='home'></u-icon>
			</view>
		</u-navbar>
	</view>
</template>

<script>
	import {
		toast,
		clearStorageSync,
		setStorageSync,
		Jump,
		getStorageSync,
		useRouter
	} from '@/utils/utils.js'
	export default {
		name:"self-navbar",
		props:{
			title: {
				require: false,
				default: ()=>{
					// 获取当前页面实例
					
				let currentPage = uni.$router
				console.log('currentPage', currentPage)
					// 获取页面路由名称
					return '';
				}
			},
			backPath: '',
			type: {
				require: false,
				default: 'redirectTo'
			}
		},
		data() {
			return {
				
			};
		},
		methods: {
			back: function() {
			if(this.backPath){
				// '/pages/mine/about/index', {}, 'navigateTo'
				useRouter(this.backPath, {}, this.type || 'redirectTo')
			}else{
				useRouter('/pages/mine/index', {}, 'switchTab')
			}
				// uni.navigateBack()
				// useRouter('/pages/mine/index', {}, 'switchTab')
			},
			home: function() {
				useRouter('/pages/home/index', {}, 'switchTab')
			},
		}
	}
</script>

<style>

</style>